package com.example.demo.service.Iml;

import com.example.demo.User;
import com.example.demo.service.UserServiec;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

@Service
public class UserServiceIml implements UserServiec {
    JdbcTemplate jdbcTemplate;
    public UserServiceIml(JdbcTemplate jdbcTemplate){
        this.jdbcTemplate=jdbcTemplate;
    }

    @Override
    public int addUser(User user) {
        String sql="insert into user(username,password,sex) values(?,?,?)";
        return jdbcTemplate.update(sql,user.getUsername(),user.getPassword(),user.getSex());
    }

    @Override
    public int updateUser(User user) {
        return 0;
    }

    @Override
    public int deleteUser(int id) {
        return 0;
    }

    @Override
    public User findUser(int id) {
        return null;
    }
}
